免费商城系统网站建设,个人网站开发技术要求,开发app的短信费用多少,丽水建设厅网站最近终于有时间写点代码相关的文章了#xff0c;工作真的太忙了#xff0c;果然又要测试又要开发的人最#x1f402;#x1f434;。 1.查询数据库有数据#xff0c;但是代码中写select语句的时候查出为null
Select(SELECT * FROM xx_manager order by id limit 1工作真的太忙了果然又要测试又要开发的人最。 1.查询数据库有数据但是代码中写select语句的时候查出为null
Select(SELECT * FROM xx_manager order by id limit 1)Results({Result(property id, column id),Result(property versionName, column version_name),Result(property os, column os),Result(property versionId, column version_id),Result(property releaseBuild, column release_build)})public xxDO selectLatest();
改动点需要加result映射字段 2.在set多个字段的时候使用AND不生效
Update(UPDATE xx_manager SET time#{time} ,release_build#{releaseBuild} WHERE version_id#{versionId})public int update(Param(versionId) Long versionId, Param(time) String time,Param(releaseBuild) Long releaseBuild);
改动点需要把AND改成 , 3.模糊查询
Select(SELECT * FROM xx_manager where version_name like concat(%,#{versionName},%) order by release_build desc)Results({Result(property id, column id),Result(property versionName, column version_name),Result(property os, column os),Result(property versionId, column version_id),Result(property releaseBuild, column release_build)})public ListxxDO queryVersionByName(String versionName); 4.Mapper常用的用法
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;import com.xwj.entity.UserEntity;public interface UserMapper {/*** 查询*/Select(SELECT id, last_name lastName, email, age FROM xwj_user WHERE id #{id} and last_name like %${lastName}% )UserEntity findById(Param(id) String id, Param(lastName) String name);/*** 新增*/Insert(INSERT INTO user(id, last_name, age) VALUES(#{id}, #{lastName}, #{age}))int addUser(Param(id) String id, Param(lastName) String name, Param(age) Integer age);/*** 更新*/Update(UPDATE user SET last_name #{lastName} WHERE id ${id})int updateUser(Param(id) String id, Param(lastName) String name);/*** 删除*/Delete(DELETE FROM user WHERE id ${id})int deleteUser(Param(id) String id);